﻿Public Class ThuVien
    Dim _DSDG As New List(Of DocGia)
    Public Sub Nhap()
        Console.Write("Nhap So Doc Gia: ")
        Dim SoDG As Integer = Convert.ToInt16(Console.ReadLine)
        For i As Integer = 0 To SoDG - 1
            Dim DG As DocGia
            Dim loaiDG As Integer
            Console.Write("Nhap loai Doc Gia (0: Nguoi Lon, 1: Tre Em) ")
            loaiDG = Convert.ToInt16(Console.ReadLine)
            If loaiDG = 0 Then
                DG = New DocGiaNguoiLon
            Else
                DG = New DocGiaTreEm
            End If
            DG.Nhap()
            _DSDG.Add(DG)
        Next
    End Sub
    Public Sub Xuat()
        For i As Integer = 0 To _DSDG.Count - 1
            Console.WriteLine("**********")
            Console.WriteLine("Thong tin Doc Gia thu {0}", i + 1)
            _DSDG(i).Xuat()
        Next
    End Sub
    Public Function TinhTongTien() As Double
        Dim Tong As Double = 0
        For i As Integer = 0 To _DSDG.Count - 1
            Tong += _DSDG(i).TinhTien
        Next
        Return Tong
    End Function
End Class
